set clip of more widgets
authorTimm Bäder <mail@baedert.org>
Thu, 4 May 2017 09:27:45 +0000 (11:27 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:11 +0000 (21:27 -0400)
14 files changed:
gtk/gtkapplicationwindow.c
gtk/gtkbin.c
gtk/gtkcalendar.c
gtk/gtkcolorbutton.c
gtk/gtkcolorplane.c
gtk/gtkfilechooserbutton.c
gtk/gtkfontbutton.c
gtk/gtkheaderbar.c
gtk/gtkiconview.c
gtk/gtkimage.c
gtk/gtkprogressbar.c
gtk/gtkrevealer.c
gtk/gtktextview.c
gtk/gtkwindow.c

index 42ce7c67e057c29409cc475601788cd132257a22..c0094c3d6a72e69f8fe368df957e1ec4ded47ab5 100644 (file)
@@ -625,6 +625,8 @@ gtk_application_window_real_size_allocate (GtkWidget     *widget,
   else
     GTK_WIDGET_CLASS (gtk_application_window_parent_class)
       ->size_allocate (widget, allocation);
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
index 7d928cac602f68d3b4d4cd1dc566c5cbda5de315..031f5c002a11995ab0b7b1b5f5d00f8e14728ee1 100644 (file)
@@ -192,11 +192,14 @@ gtk_bin_size_allocate (GtkWidget     *widget,
   GtkBin *bin = GTK_BIN (widget);
   GtkBinPrivate *priv = bin->priv;
 
-  gtk_widget_set_allocation (widget, allocation);
-
   if (priv->child && gtk_widget_get_visible (priv->child))
     {
+      GtkAllocation clip = *allocation;
+
       gtk_widget_size_allocate (priv->child, allocation);
+      gtk_widget_get_clip (priv->child, &clip);
+
+      gtk_widget_set_clip (widget, &clip);
     }
 }
 
index 96183235e08462ca67a4d855da5b033b572b7add..d9baabd7a969e9961db920657038c8cc3a68799c 100644 (file)
@@ -2119,6 +2119,8 @@ gtk_calendar_size_allocate (GtkWidget     *widget,
             }
         }
     }
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 \f
index 7f289b5be79cdd68d189254c00d8410919a36312..2d63e8d175dec22b1beb6050e396b032b4e6dbff 100644 (file)
@@ -173,10 +173,12 @@ gtk_color_button_size_allocate (GtkWidget     *widget,
 {
   GtkColorButton *button = GTK_COLOR_BUTTON (widget);
   GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
-
-  GTK_WIDGET_CLASS (gtk_color_button_parent_class)->size_allocate (widget, allocation);
+  GtkAllocation clip = *allocation;
 
   gtk_widget_size_allocate (priv->button, allocation);
+  gtk_widget_get_clip (priv->button, &clip);
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
index 9c4e68a02900db9d347c9f7af9cefe3cf14c4ded..addc1552dcbbd8155572b27facad5557b9b0ee63 100644 (file)
@@ -184,9 +184,8 @@ plane_size_allocate (GtkWidget     *widget,
 {
   GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
 
-  GTK_WIDGET_CLASS (gtk_color_plane_parent_class)->size_allocate (widget, allocation);
-
   create_surface (plane);
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
index 179cc22ee4306d882791abb89c120eacbd2d476a..18fdde973ce12cec1a74ad9fc4fd4bc3c010518a 100644 (file)
@@ -386,10 +386,12 @@ gtk_file_chooser_button_size_allocate (GtkWidget     *widget,
 {
   GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
   GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
-
-  GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->size_allocate (widget, allocation);
+  GtkAllocation clip = *allocation;
 
   gtk_widget_size_allocate (priv->child, allocation);
+  gtk_widget_get_clip (priv->child, &clip);
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
index 10c73d764002edd3f9faf2db1c84da674a00ba68..4f06b92d94a2c5fa1c4565b958db3fcd06dae7fa 100644 (file)
@@ -468,10 +468,12 @@ gtk_font_button_size_allocate (GtkWidget     *widget,
 {
   GtkFontButton *button = GTK_FONT_BUTTON (widget);
   GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
-
-  GTK_WIDGET_CLASS (gtk_font_button_parent_class)->size_allocate (widget, allocation);
+  GtkAllocation clip = *allocation;
 
   gtk_widget_size_allocate (priv->button, allocation);
+  gtk_widget_get_clip (priv->button, &clip);
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
index 60766a458b963484330fea854e3d78c13310dbcb..f4bcda64813eb65628d9fdf3c3eef8879c0bfc43 100644 (file)
@@ -897,7 +897,7 @@ gtk_header_bar_size_allocate (GtkWidget     *widget,
                               GtkAllocation *allocation)
 {
   GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
-  GtkAllocation clip;
+  GtkAllocation clip = *allocation;
   GtkWidget *title_widget;
   GtkHeaderBar *bar = GTK_HEADER_BAR (widget);
   GtkRequestedSize *sizes;
index dfed670b4d8b30d990f3aa4b0163505114461086..fcb25b566375aaec62aa191aadb6d6f2f5f6edbf 100644 (file)
@@ -1675,8 +1675,6 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
 {
   GtkIconView *icon_view = GTK_ICON_VIEW (widget);
 
-  gtk_widget_set_allocation (widget, allocation);
-
   gtk_icon_view_layout (icon_view);
 
   if (gtk_widget_get_realized (widget))
@@ -1714,6 +1712,8 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
   /* Emit any pending signals now */
   g_object_thaw_notify (G_OBJECT (icon_view->priv->hadjustment));
   g_object_thaw_notify (G_OBJECT (icon_view->priv->vadjustment));
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
index 2f8fae67237c051b6874eb82cfd5cbaca04f4236..cb31c6c032f71da7d2dcdad2b02f5b8b1e7a3802 100644 (file)
@@ -1275,7 +1275,7 @@ static void
 gtk_image_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
-  GtkAllocation clip;
+  GtkAllocation clip = *allocation;
   GdkRectangle extents;
 
   _gtk_style_context_get_icon_extents (gtk_widget_get_style_context (widget),
index 5d4016513eb34bfba9609716a404f1f9addb4183..b1449c08975dc64b626267719cf2628e08211791 100644 (file)
@@ -662,7 +662,10 @@ gtk_progress_bar_size_allocate (GtkWidget     *widget,
   gdk_rectangle_union (&clip, &child_clip, &clip);
 
   if (!priv->show_text)
-    return;
+    {
+      gtk_widget_set_clip (widget, &clip);
+      return;
+    }
 
   gtk_widget_measure (priv->label, GTK_ORIENTATION_HORIZONTAL, -1,
                       &text_min, &text_nat,
index 0e4608cc8a9b66553fd5dd0e3f81d20c35f14a41..96f8952839a2ded6e6372184178a6f8ef5c384ee 100644 (file)
@@ -441,15 +441,18 @@ gtk_revealer_real_size_allocate (GtkWidget     *widget,
   int bin_x, bin_y;
   GtkRevealerTransitionType transition;
   GtkBorder padding;
+  GtkAllocation clip = *allocation;
 
   g_return_if_fail (allocation != NULL);
 
-  gtk_widget_set_allocation (widget, allocation);
   gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
 
   child = gtk_bin_get_child (GTK_BIN (revealer));
   if (child != NULL && gtk_widget_get_visible (child))
-    gtk_widget_size_allocate (child, &child_allocation);
+    {
+      gtk_widget_size_allocate (child, &child_allocation);
+      gtk_widget_get_clip (child, &clip);
+    }
 
   if (gtk_widget_get_realized (widget))
     {
@@ -501,6 +504,8 @@ gtk_revealer_real_size_allocate (GtkWidget     *widget,
                               bin_y + allocation->y,
                               child_allocation.width, child_allocation.height);
     }
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
index 1011388aae835378b7d7a37b6715bcae4dc6e84e..82a70a3f8d5651b72ebb994b4615cf8db06c3863 100644 (file)
@@ -4312,6 +4312,8 @@ gtk_text_view_size_allocate (GtkWidget *widget,
    */
   if (size_changed)
     gtk_widget_queue_draw (widget);
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
index b476321fefe7192cf3ea27c50953c91cf6d859de..135f1c86ad41f8a036a051e964863565fe96fde5 100644 (file)
@@ -7222,6 +7222,8 @@ gtk_window_size_allocate (GtkWidget     *widget,
     gtk_widget_size_allocate (child, &child_allocation);
 
   gtk_window_restack_popovers (window);
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static gint